package com.jumi.microservice.material.mapper;

import com.jumi.microservice.material.domain.JmWarehouse;
import com.jumi.microservice.material.dto.warehouse.JmWarehouseRequest;
import com.jumi.microservice.material.dto.warehouse.JmWarehouseResponse;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author ssk
 * @create 2020/7/20 16:22
 **/
public interface JmWarehouseMapper {

    /**
     * 保存方法
     *
     * @param jmWarehouse
     * @return
     */
    int save(JmWarehouse jmWarehouse);

    /**
     * 更新方法
     *
     * @param jmWarehouse
     * @return
     */
    int update(JmWarehouse jmWarehouse);

    /**
     * 根据id查询实体类
     *
     * @param storeId
     * @return
     */
    JmWarehouseResponse findById(Long storeId);

    /**
     * 根据条件查询实体类集合
     *
     * @param jmWarehouse
     * @return
     */
    List<JmWarehouseResponse> findAll(JmWarehouseRequest jmWarehouse);

    /**
     * 根据仓库名查询是否存在
     * 防止重复插入
     *
     * @param warehouseName
     * @return
     */
    int findCountByWarehouseName(@Param("warehouseName") String warehouseName,@Param("warehouseId")Long warehouseId);

    /**
     * 根据地区id获取地区名称
     * @param areaId
     * @return
     */
    String findAreaName(Long areaId);

    /**
     * 批量获取地区名称
     * @param areaIds
     * @return
     */
    List<Map> findAreaNames(List<Long> areaIds);

    /**
     * @Description: 查询仓库列表
     * @Param categoryIds
     * @Return {@link List<  JmWarehouseResponse >}
     * @Throws
     * @Author Abel Yang
     * @Date 2020/8/20/020 14:00
     */
    List<JmWarehouseResponse> getWarehouseList();

    List<Map<String,Object>> findArea(@Param("deep") Integer deep, @Param("parentId") Long parentId);

	Integer getWarehouseIdByWarehouseName(String warehouseName);

	String getWarehouseNameByWarehouseId(Integer warehouseId);
}
